package com.example.airport.net.datarequest;

import com.google.gson.Gson;

import java.io.IOException;
import java.lang.reflect.Type;

import okhttp3.ResponseBody;

public class JsonAdapter {

    public static Object JSONTOBean(ResponseBody body, Type type)
    {
        Object obj = null;
        try
        {
            String json = new String(body.bytes());
            Gson gson = new Gson();
            obj = gson.fromJson(json, type);
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
        return obj;
    }

}
